package team.qwer.demo.module1.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team.qwer.demo.module1.dao.TestDao;
import team.qwer.demo.module1.entity.Test;
import team.qwer.demo.module1.util.PubFun;

import java.util.List;

/**
 * @Author Administrator
 * @Date 2019/2/17 0017 14:03
 **/
@Service
public class TestService {

    private final TestDao testDao;

    @Autowired
    public TestService(TestDao testDao) {
        this.testDao = testDao;
    }

    public int save(String name){
        Test test  = new Test();
        test.setId(PubFun.getUUID());
        test.setName(name);
        return testDao.save(test);
    }

    public List<Test> query(){
        return testDao.query();
    }

    public List<Test> queryByCondition(String name){
        return testDao.queryByCondition(name);
    }
}
